import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '发起人名称',
		align: "center",
		dataIndex: 'initiatorName'
	},
	/* {
		title: '接收人',
		align: "center",
		dataIndex: 'recipientId_dictText'
	}, */
	{
		title: '发起人类别',
		align: "center",
		dataIndex: 'initiatorType_dictText'
	},
	{
		title: '关联行程',
		align: "center",
		dataIndex: 'journeyId_dictText'
	},
	{
		title: '消息类别',
		align: "center",
		dataIndex: 'infoType_dictText'
	},
	{
		title: '通知对象',
		align: "center",
		dataIndex: 'notifyObj_dictText'
	},
	{
		title: '微信模板',
		align: "center",
		dataIndex: 'wxMsg_dictText'
	},
	{
		title: '系统消息内容',
		align: "center",
		dataIndex: 'msg'
	},
	{
		title: '短信变量内容',
		align: "center",
		dataIndex: 'variantContent'
	},
	{
		title: '发起方式',
		align: "center",
		dataIndex: 'initiatingMode_dictText'
	},
	{
		title: '消息模板',
		align: "center",
		dataIndex: 'messageTemplate_dictText'
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId'
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
	{
		label: "关联行程",
		field: 'journeyId',
		component: 'JSearchSelect',
		componentProps: {
			dict: "couple_activity_carpool_bus,carpool_number,id"
		},
		//colProps: {span: 6},
	},
	/* {
		label: "发起人类别",
		field: 'initiatorType',
		component: 'JDictSelectTag',
		componentProps: {
			dict: 'info_initiator_type'
		},
	}, */
	{
		label: "消息类别",
		field: 'infoType',
		component: 'JSearchSelect',
		componentProps: {
			dict: "sys_category,name,id,pid='1733823765838475265'"
		},
		
		//colProps: {span: 6},
	},
	{
		label: "系统消息内容",
		field: 'msg',
		component: 'Input',
		//colProps: {span: 6},
	},
	{
		label: "通知方式",
		field: 'initiatingMode',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: 'info_send_type'
		},
		//colProps: {span: 6},
	},
	{
		label: "消息模板",
		field: 'messageTemplate',
		component: 'JSearchSelect',
		componentProps: {
			dict: "couple_message_template,info_title,id"
		},
		//colProps: {span: 6},
	},
];
//表单数据
export const formSchema : FormSchema[] = [
	{
		label: '接收人',
		field: 'recipientId',
		component: 'JSearchSelect',
		componentProps: {
			dict: "couple_user,user_name,id"
		},
	},
	{
		label: '通知对象',
		field: 'notifyObj',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "info_notify_obj"
		},
		required: true,
	},
	{
		label: '消息分类',
		field: 'infoType',
		component: 'JSearchSelect',
		componentProps: {
			dict: "sys_category,name,id,pid='1733823765838475265'"
		},
		required: true,
	},
	{
		label: '消息模板',
		field: 'msgTemplage',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "couple_message_template,info_title,id"
		},
		required: true,
	},
	{
		label: '通知方式',
		field: 'sendType',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "info_send_type"
		},
		required: true,
	},
	{
		label: '系统消息',
		field: 'msg',
		component: 'InputTextArea',
		ifShow: ({ values }) => {
			return values.sendType == 3 || values.sendType == 4 || values.sendType == 5 || values.sendType == 6
		},
	},
	{
		label: '微信模板内容',
		field: 'wxMsg',
		component: 'InputTextArea',
		helpMessage: '填写方式：内容+,例如：张三,12月7号集合。不超过20个字',
		ifShow: ({ values }) => {
			return values.sendType == '1' || values.sendType == '4' || values.sendType == '5'
		},
	},
	{
		label: '短信变量内容',
		field: 'variantContent',
		component: 'Input',
		helpMessage: '填写方式：内容+,例如：张三,12月7号集合。不超过20个字',
		ifShow: ({ values }) => {
			return values.sendType == '4' || values.sendType == '2' || values.sendType == 6
		},
	},
	/* {
		label: '租户',
		field: 'tenantId',
		component: 'Input',
		
	}, */
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];


//子表列表数据
export const coupleInformDetailColumns: BasicColumn[] = [
   {
    title: '内容',
    align:"center",
    dataIndex: 'msg'
   },
   {
    title: '类别',
    align:"center",
    dataIndex: 'infoType_dictText'
   },
   {
    title: '接收者',
    align:"center",
    dataIndex: 'receiverUserId_dictText'
   },
   {
    title: '接收者电话',
    align:"center",
    dataIndex: 'receiverUserPhone'
   },
   {
    title: '接收状态',
    align:"center",
    dataIndex: 'infoStatus_dictText'
   },
];
//子表表单数据
export const coupleInformDetailFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}